package com.dao.impl;

import com.Bean.Goods;
import com.Bean.GoodsAndType;
import com.Bean.RoomAndRoomType;
import com.dao.GoodsDao;
import com.util.JdbcUtil;

import java.sql.SQLException;
import java.util.List;

public class GoodsDaoImpl implements GoodsDao {
    @Override
    public int insert(Goods goods) throws SQLException {
        return 0;
    }

    @Override
    public List<Goods> queryData(Goods goods) throws IllegalAccessException, SQLException, InstantiationException {
        return null;
    }

    @Override
    public int update(Goods goods) throws SQLException {
        return 0;
    }

    @Override
    public int deleteById(Object id) throws SQLException {
        return 0;
    }
    //返回所有的商品and类型
    public List<GoodsAndType> queryGoodsandType() throws IllegalAccessException, SQLException, InstantiationException {
        String sql="select goods.gtid,goods.gname,goods.gprice,goods.gid,goodstype.gtype from goods,goodstype where  goods.gtid=goodstype.gtid ORDER BY goodstype.gtype";
        List<GoodsAndType> goodsAndTypes = JdbcUtil.queryGoodsdandtype(sql);
        return goodsAndTypes;
    }

}
